<template>
	<view class="doctor-container">
		<scroll-view class="scroll-view_H" scroll-y="true">
			<view class="flex flex-column align-center" style="padding-top: 30rpx;">
				<view style="width: 94%;margin-left: 3%;">
					<view class="custom-title flex align-center">
						<view class="dot"></view>
						<text class="f-bold color-323232 f-s-32">科室简介</text>
					</view>
					<view class=" p-l-12 p-r-12 m-t-15">
						<text class="color-666 f-s-30">{{articleTitle}}</text>
					</view>
				</view>
				<view class="m-t-30" style="width: 94%;margin-left: 3%;">
					<view class="custom-title flex align-center">
						<view class="dot"></view>
						<text class="f-bold color-323232 f-s-32">科室详情</text>
					</view>
					<view class=" p-l-12 p-r-12 m-t-15">
						<text class="color-666 f-s-30">{{articleContent}}</text>
					</view>
				</view>
				<view class="m-t-30" style="width: 94%;margin-left: 3%;">
					<view class="custom-title flex align-center">
						<view class="dot"></view>
						<text class="f-bold color-323232 f-s-32">科室医生</text>
					</view>
					<doctorList :deptCode="deptCode"></doctorList>
				</view>
			</view>
			
		</scroll-view>
		
		<view class="to-register" @click="toRegistration">
			<u-button type="primary" text="去挂号"></u-button>
		</view>
	</view>
</template>

<script>
	import {
		getDeptDetail
	} from "@/api/home/home.js";
	import doctorList from "./doctorList.vue"
	export default {
		components:{doctorList},
		data() {
			return {
				id: '',
				deptCode:'',
				articleTitle: '',
				articleContent: '',
				deptInfo:{}
			}
		},
		onLoad: function(res) {
			console.log(res)
			uni.setNavigationBarTitle({
				title: res.deptName || '科室详情'
			});
			this.id = res.id
			this.deptCode = res.deptCode
			this.getData()
		},
		methods: {
			/* 去挂号 */
			toRegistration() {
				uni.navigateTo({
					url: '/pages/home/deptRegistration?registerType=2&deptCode='+this.deptInfo.deptCode+'&wardCode='+this.deptInfo.wardCode
				})
			},
			/* 获取科室详情 */
			getData() {
				getDeptDetail(this.id).then(res => {
					console.log(res)
					this.articleTitle = res.data.articleTitle || ''
					this.articleContent = res.data.articleContent || ''
					this.deptInfo = res.data
				});
			},

		}
	}
</script>

<style scoped lang="scss">
	page {
		height: 100%;

		.doctor-container {
			width: 100%;
			height: 100%;
			position: relative;
			background-color: #F6F7F9;

			.to-register {
				width: 94%;
				margin-left: 3%;
				position: absolute;
				bottom: 10rpx;
			}

			.scroll-view_H {
				width: 100%;
				height: 100%;
				padding-bottom: 100rpx;

				.custom-title {
					.dot {
						width: 10rpx;
						height: 32rpx;
						border-radius: 10rpx;
						background-color: #4D8EFF;
						margin-right: 10rpx;
					}
				}


				.avatar {
					width: 160rpx;
				}


			}

		}

	}
</style>
